﻿#include <iostream>
#include <assert.h>
#include <filesystem>
using namespace std;

#define TEST_ALL_MODULE		0

#define TEST_RINGBUFFER		0
#define TEST_GRAPH      	0
#define TEST_ASYNLOG		0
#define TEST_THREADPOOL		0
#define TEST_MYUTIL		    0
#define TEST_REQUEST		1

#if TEST_ALL_MODULE
#define TEST_RINGBUFFER		1
#define TEST_GRAPH		    1
#define TEST_ASYNLOG		1
#define TEST_THREADPOOL		1
#define TEST_MYUTIL		    1
#define TEST_REQUEST		1
#endif

#if TEST_RINGBUFFER
#include "ringbufferTest/ringbufferTest.h"
#endif
#if TEST_GRAPH
#include "graphTest/graphTest.h"
#endif
#if TEST_ASYNLOG
#include "libasynlogTest/libasynlogTest.h"
#endif
#if TEST_THREADPOOL
#include "libthreadpoolTest/libthreadpoolTest.h"
#endif
#if TEST_MYUTIL
#include "libmyutilTest/libmyutilTest.h"
#endif
#if TEST_REQUEST
#include "librequestTest/librequestTest.h"
#endif

int main()
{
#if TEST_RINGBUFFER
    RingbufferTest(5, 3);
#endif

#if TEST_GRAPH
    GraphTest();
#endif

#if TEST_ASYNLOG
    string input;
    while (1)
    {
        printf("please input:\n");
        std::getline(std::cin, input);
        if (input == "q") {
            break;
        }
        else {
            std::vector<string> vecParam = myutil::split_string<string>(input, " ");
            assert(vecParam.size() == 2);
            if (vecParam.size() == 2)
            {
                int size = atoi(vecParam[0].c_str());
                int threadNum = atoi(vecParam[1].c_str());
                if (size < 1) size = 1;
                if (size > 20) size = 20;
                if (threadNum < 1) threadNum = 1;
                if (threadNum > 16) threadNum = 16;
                LibAsynLogTest(size * 1000, threadNum);
            }
        }
    }
#endif

#if TEST_THREADPOOL
    LibThreadpoolTest();
#endif

#if TEST_MYUTIL
    LibmyutilTest();
#endif

#if TEST_REQUEST
    LibRequestTest();
#endif
    
	return 0;
}




